import axios from "axios";

const instance = axios.create({
    baseURL: "http://localhost:3002",
    timeout: 5000,
});
instance.interceptors.request.use(
    function (config) {

        return config;
    },
    function (error) {
        return Promise.reject(error);
    }
);
instance.interceptors.response.use(
    function (response) {
        return response.data;
    },
    function (error) {
        return Promise.reject(error);
    }
);

export const get = (url, params) => instance.get(url, {
    params
});

export const post = (url, data) => instance.post(url, data);

export const del = (url) => instance.delete(url);

export const put = (url, data) => instance.put(url, data)